package com.gxa.p2p.controller;

import com.gxa.p2p.service.CertificateMaterialService;
import com.gxa.p2p.service.VerifiedInfoService;
import com.gxa.p2p.util.MapUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@CrossOrigin
@Controller
@ResponseBody
@Api(value = "借款身份认证/风控审核控制器",tags = "borrowingAuditController")
@RequestMapping("/borrowingAudit")
public class BorrowingAuditController {
    @Resource
    private CertificateMaterialService certificateMaterialService;
    @Resource
    private VerifiedInfoService verifiedInfoService;


    @GetMapping("/findByBorrowingAudit")
    @ResponseBody
    @ApiOperation(value = "实名认证状态审核接口", response = List.class, httpMethod = "GET")
    public Map<String, Object> findByBorrowingAudit
            (@RequestParam(name = "userId", defaultValue = "") Integer userId) {
        Integer reviewStatus = verifiedInfoService.findByReviewStatus(userId).getReviewStatus();
        String desc = verifiedInfoService.findByReviewStatus(userId).getDesc();
        Integer reviewScore = certificateMaterialService.findByCM(userId).getReviewScore();
        MapUtil mapUtil = new MapUtil();

        mapUtil.setMsg("审核结果");
        mapUtil.put("reviewStatus",reviewStatus);
        mapUtil.put("desc",desc);
        mapUtil.put("reviewScore",reviewScore);

         return mapUtil.getMap();
    }
}